package han.cirno.corrupt.data.instances

import androidx.room.Entity
import androidx.room.PrimaryKey
import han.cirno.cirno_dao.CirnoDaoAwA
import han.cirno.cirno_dao.CirnoSingleQuery
import java.util.Date

object UserTaskData {
    var draftTaskData:TaskData?=null
    @CirnoDaoAwA
    @Entity
    class TaskTag(
        var tagName:String?,
        var tagColor:Int?=null,//Null means no color
        @CirnoSingleQuery @PrimaryKey val uid:Long=System.currentTimeMillis()
    )
    @CirnoDaoAwA
    @Entity
    data class TaskData(
        var name:String?=null,
        var description:String?=null,
        var createdTime:Date?=null,
        var finishedTime:Date?=null,
        var submittedTime:Date?=null,
        var isCompleted:Boolean=false,
        var isSubmitted:Boolean=false,
        var tags:MutableList<Long> =ArrayList(),
        @PrimaryKey var uid:Long=System.currentTimeMillis()
    ) {
        fun copyToThis(taskData:TaskData) {
            this.name=taskData.name
            this.description=taskData.description
            this.createdTime=taskData.createdTime
            this.finishedTime=taskData.finishedTime
            this.submittedTime=taskData.submittedTime
            this.tags=taskData.tags
            this.isSubmitted=taskData.isSubmitted
            this.isCompleted=taskData.isCompleted
            this.uid=taskData.uid
        }
    }
}
